//
//  OBContant.h
//  XZXSchool
//
//  Created by obally on 2017/10/23.
//  Copyright © 2017年 obally. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
/// Block
///------
typedef void (^VoidBlock)(void);
typedef BOOL (^BoolBlock)(void);
typedef int  (^IntBlock) (void);
typedef id   (^IDBlock)  (void);

typedef void (^VoidBlock_int)(int);
typedef BOOL (^BoolBlock_int)(int);
typedef int  (^IntBlock_int) (int);
typedef id   (^IDBlock_int)  (int);

typedef void (^VoidBlock_string)(NSString *);
typedef BOOL (^BoolBlock_string)(NSString *);
typedef int  (^IntBlock_string) (NSString *);
typedef id   (^IDBlock_string)  (NSString *);

typedef void (^VoidBlock_id)(id);
typedef BOOL (^BoolBlock_id)(id);
typedef int  (^IntBlock_id) (id);
typedef id   (^IDBlock_id)  (id);


/// 全局分割线高度 .5
FOUNDATION_EXTERN CGFloat const OBGlobalBottomLineHeight;
/// footerViewHeight
FOUNDATION_EXTERN CGFloat const OBMomentFooterViewHeight ;
///网络通知
FOUNDATION_EXTERN NSString *const OBNetWorkNotification;
//// 朋友圈说说
/// 说说内容距离顶部的间距 16
FOUNDATION_EXTERN CGFloat const OBMomentContentTopInset;
/// 说说内容距离左右屏幕的间距 20
FOUNDATION_EXTERN CGFloat const OBMomentContentLeftOrRightInset;
/// 内容（控件）之间的的间距 10
FOUNDATION_EXTERN CGFloat const OBMomentContentInnerMargin;
/// 用户头像的大小 44x44
FOUNDATION_EXTERN CGFloat const OBMomentAvatarWH;
///朋友圈头像宽高
FOUNDATION_EXTERN CGFloat const OBMomentProfileViewAvatarViewWH;
/// 向上箭头W
FOUNDATION_EXTERN CGFloat const OBMomentUpArrowViewWidth ;
/// 向上箭头H
FOUNDATION_EXTERN CGFloat const OBMomentUpArrowViewHeight ;

/// 全文、收起W
FOUNDATION_EXTERN CGFloat const OBMomentExpandButtonWidth ;
/// 全文、收起H
FOUNDATION_EXTERN CGFloat const OBMomentExpandButtonHeight ;
/// pictureView中图片之间的的间距 6
FOUNDATION_EXTERN CGFloat const OBMomentPhotosViewItemInnerMargin;
/// pictureView中图片的大小 86x86 (屏幕尺寸>320)
FOUNDATION_EXTERN CGFloat const OBMomentPhotosViewItemWH1;
/// pictureView中图片的大小 70x70 (屏幕尺寸<=320)
FOUNDATION_EXTERN CGFloat const OBMomentPhotosViewItemWH2;
/// 微信正文内容的显示最大行数（PS：如果超过最大值，那么正文内容就单行显示，可以点击正文内容查看全部内容）
FOUNDATION_EXTERN NSUInteger const OBMomentContentTextMaxCriticalRow ;
/// 微信正文内容显示（全文/收起）的临界行
FOUNDATION_EXTERN NSUInteger const OBMomentContentTextExpandCriticalRow ;

/// pictureView最多显示的图片数
FOUNDATION_EXTERN NSUInteger const OBMomentPhotosMaxCount ;

/// 单张图片的最大高度（等比例）180
FOUNDATION_EXTERN CGFloat const OBMomentPhotosViewSingleItemMaxHeight;
/// pictureView显示图片的最大列数
#define OBMomentMaxCols(__photosCount) ((__photosCount==4)?2:3)

//// 评论和点赞view 常量
/// 评论内容距离顶部的间距 5
FOUNDATION_EXTERN CGFloat const OBMomentCommentViewContentTopOrBottomInset;
/// 评论内容距离评论View左右屏幕的间距 9
FOUNDATION_EXTERN CGFloat const OBMomentCommentViewContentLeftOrRightInset;
/**
 YYTextHighlight *highlight = [YYTextHighlight new];
 highlight.userInfo = @{kWBLinkHrefName : href};
 */
//// 这里是点击文本链接（or其他）跳转，通过该key从userInfo中取出对应的数据
/// 点击链接
FOUNDATION_EXTERN NSString * const OBMomentLinkUrlKey ;
/// 电话号码key
FOUNDATION_EXTERN NSString * const OBMomentPhoneNumberKey ;



//// ---------------- inline ----------------

/// 图片的宽度 （九宫格）
static inline CGFloat OBMomentPhotosViewItemWidth(){
    CGFloat itemW = ([UIScreen mainScreen].bounds.size.width<=320)? OBMomentPhotosViewItemWH2:OBMomentPhotosViewItemWH1;
    return itemW;
}


/// 单张图片的最大宽度（方形or等比例）
static inline CGFloat OBMomentPhotosViewSingleItemMaxWidth(){
    CGFloat itemW = OBMomentPhotosViewItemWidth();
    return OBMomentPhotosViewItemInnerMargin + itemW*2;
}

/// 计算微信说说正文的limitWidth或者评论View的宽度
static inline CGFloat OBMomentCommentViewWidth() {
    return ([UIScreen mainScreen].bounds.size.width - OBMomentContentLeftOrRightInset*2 -OBMomentAvatarWH - OBMomentContentInnerMargin);
}

/// 配图的占位图片
static inline UIImage *OBPicturePlaceholder()
{
    return [UIImage imageNamed:@"wx_timeline_image_placeholder"];
}
typedef NS_ENUM(NSUInteger, OBDefaultAvatarType) {
    OBDefaultAvatarTypeSmall = 0,  /// 小图 34x34
    OBDefaultAvatarTypeDefualt,    /// 默认 50x50
    OBDefaultAvatarTypeBig,        /// 大图 85x85
};
/// 占位头像
static inline UIImage *OBDefaultAvatar(OBDefaultAvatarType type)
{
    switch (type) {
        case OBDefaultAvatarTypeSmall:
            return [UIImage imageNamed:@"wx_avatar_default_small"];
            break;
        case OBDefaultAvatarTypeBig:
            return [UIImage imageNamed:@"wx_avatar_default_big"];
            break;
        default:
            return [UIImage imageNamed:@"wx_avatar_default"];
            break;
    }
}

